package manager.goods;

import common.db.*;
import common.main.*;

public class GoodsListBean extends MainBean
{
	public void funcExecute() throws Exception
	{
		String sort = (String)inputTable.get("sort");
		String section = (String)inputTable.get("section");
		String word = (String)inputTable.get("word");
		queryBuffer = new StringBuffer("");
		
		queryBuffer.append("SELECT ");
		queryBuffer.append("GCODE, GNAME, PURCHARSE_WAY, "); 
		queryBuffer.append("STOCK_VALUE, COST, GOODS_PRICE, "); 
		queryBuffer.append("SAVING_POINT, MK_DATE, EX_DATE, "); 
		queryBuffer.append("SE_DATE, TE_DATE, SELL_CNT, "); 
		queryBuffer.append("REG_ID, TO_CHAR(REG_DATE, 'YYYY-MM-DD') REG_DATE, REG_IP, "); 
		queryBuffer.append("UPD_ID, UPD_DATE, UPD_IP, ");  
		queryBuffer.append("USE_YN ");
		queryBuffer.append("FROM GOODS ");
		if(word.length() > 0)
		{
			if(section.equals("TC"))
			{
				queryBuffer.append("WHERE GCODE LIKE '%" + word + "%' ");
			}
			else if(section.equals("TT"))
			{
				queryBuffer.append("WHERE GNAME LIKE '%" + word + "%' ");
			}	
		}
		
		queryBuffer.append("ORDER BY " + sort);

		DBExecute dbe = new DBExecute(queryBuffer.toString());
		outputList = dbe.getDataList();
	}
}